package steps
{
	import jnBase.BaseZhishi;
	import jnBase.Data;
	import jnBase.InsPages;
	import jnBase.PSteps;
	
	import laya.display.Sprite;
	import laya.utils.Handler;
	import laya.utils.Tween;
	
	import ui.steps.step5_huxiUI;

	public class Step05_HuXi extends step5_huxiUI implements InsPages
	{
		public var _scriptPage:PSteps;
		public var _scriptZhishi:BaseZhishi;
		private var zhishiStr:String="";
		public function Step05_HuXi()
		{
			super();
			size(1920,1080);
			this.name="5.呼吸的记录";
			_scriptPage=this.addComponent(PSteps);
			_scriptZhishi=this.addComponent(BaseZhishi);
		}
		public function changeSonStep():void
		{
			
			_scriptZhishi.showTips("将实际测量的呼吸次数，以阿拉伯数字表示，免写计量单位，用红钢笔填写在相应的呼吸栏内");
			_scriptZhishi.xiankuangClick(677,336,101,62,function():void{
				_scriptZhishi.clearLoop();
				_scriptZhishi.hideLine();
				
				Tween.to(txt1,{alpha:1},500);
				Laya.timer.once(2000,this,function():void{
					_scriptZhishi.showTips("相邻的两次呼吸上下错开记录，每页首记呼吸从上开始写。");
					Laya.timer.once(2000,this,function():void{
						Tween.to(txt2,{alpha:1},500);
						Tween.to(txt3,{alpha:1},500);
						Tween.to(txt4,{alpha:1},500);
						Tween.to(txt5,{alpha:1},500);
						Laya.timer.once(2000,this,function():void{
							_scriptZhishi.showTips("使用呼吸机病人的呼吸以®表示，在体温单相应时间内顶格用黑笔画®。");
							_scriptZhishi.xiankuangClick(1184,335,101,62,function():void{
								Tween.to(R,{alpha:1},500);
								_scriptZhishi.clearLoop();
								_scriptZhishi.hideLine();
								Laya.timer.once(1000,this,function():void{
									Tween.to(txt7,{alpha:1},500);
								});
								Laya.timer.once(2000,this,function():void{
									_scriptPage.addPage(5);
								});
							});
						});
						
					});
				});
			 
			});
		}
		
		/**
		 *切换二级菜单时自动调用
		 * 显示新的二级页面时会自动调用此方法 
		 * 
		 */		
		public function reset():void
		{
			_scriptZhishi.hideAll();
			removeAllListener();
			zhishiStr="";
		}
		/**
		 *移除所有监听 
		 * 
		 */		
		public function removeAllListener():void
		{
			_scriptZhishi.removeAllHandler();	
		}
		override public function onEnable():void{
			reset();
		}
		/**
		 *关闭时自动调用 
		 * @param type
		 * 
		 */		
		override public function close(type:String=null):void
		{
			// TODO Auto Generated method stub
			_scriptPage.enabled=false;
			_scriptZhishi.enabled=false;
			removeAllListener();
			Tween.to(this,{x:-GameConfig.width,alpha:0},300,null,Handler.create(this,closeSuper,[type]));
		}
		private function closeSuper(type:String=null):void{
			super.close(type);
		}
		/**
		 *每秒执行一次 
		 * 
		 */		
		public function lineLoop():void
		{
			// TODO Auto Generated method stub
			if(zhishiStr==""){
				_scriptZhishi.zhishiRect.alpha=1;
				Tween.to(_scriptZhishi.zhishiRect,{alpha:0.1},600);
			}
			else if(zhishiStr=="xi"){
				_scriptZhishi.mdown.visible=true;
				_scriptZhishi.mdown.pos(958,688);
				_scriptZhishi.mdown.rotation=-155;
				Tween.to(_scriptZhishi.mdown,{x:990,y:596},600);
			}
		}
		/**
		 *被移除时自动调用  
		 * 因为设置了自动销毁，所以关闭后后会执行销毁 ，因为关闭时加了一个动画，所以要300毫秒后才执行销毁
		 * 
		 */		
		override public function onDestroy():void{
			trace(this.name+"销毁");
		}
	}
}